#!/bin/sh
if [ "${POSTUREPATH}" == "" ]; then
  echo "缺少POSTUREPATH配置 (You missed the configuration of POSTUREPATH)"
  exit 1
fi
. $POSTUREPATH/include/function.sh

COMMAND=$1
if [ "${COMMAND}" == "sethook" ]; then
  sethook $currentDir
elif [ "${COMMAND}" == "adjust" ]; then
  checkConfig && adjust
elif [ "${COMMAND}" == "info" ]; then
  showInfo
elif [ "${COMMAND}" == "update" ]; then
  updateVersion
elif [ "${COMMAND}" == "help" ]; then
  echo "下面是posture支持的命令列表 (Here is support commands)"
  echo "  sethook: 设置全局钩子 (set the global git hooks)"
  echo "  adjust: 调整代码规范 (adjust the code specification)"
  echo "  update: 更新至最新版本 (update to latest version)"
  echo "  info: 展示posture配置的相关信息 (show the information of posture)"
  echo "  help: 查看帮助 (view help)"
else
  echo "不支持的命令: ${COMMAND} (Unknown command: ${COMMAND})"
fi
